package com.lyz.myself.config.utils.oss;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class ConstantProperties implements InitializingBean{

    @Value("${spring.file.endpoint}")
    private String oss_file_endpoint;

    @Value("${spring.file.keyid}")
    private String oss_file_keyid;

    @Value("${spring.file.keysecret}")
    private String oss_file_keysecret;

    @Value("${spring.file.filehost}")
    private String oss_file_filehost;

    @Value("${spring.file.bucketname}")
    private String oss_file_bucketname;

    @Value("${prop.upload-folder}")
    private String propUploadFolder;


    public static String OSS_END_POINT         ;
    public static String OSS_ACCESS_KEY_ID     ;
    public static String OSS_ACCESS_KEY_SECRET ;
    public static String OSS_BUCKET_NAME      ;
    public static String OSS_FILE_HOST         ;
    public static String FOLDER_VIDEO;
    public static String PROP_UPLOAD_FOLDER;

    @Override
    public void afterPropertiesSet() throws Exception {
        OSS_END_POINT = oss_file_endpoint;
        OSS_ACCESS_KEY_ID = oss_file_keyid;
        OSS_ACCESS_KEY_SECRET = oss_file_keysecret;
        OSS_FILE_HOST = oss_file_filehost;
        OSS_BUCKET_NAME = oss_file_bucketname;
        FOLDER_VIDEO = "videos";
        PROP_UPLOAD_FOLDER = propUploadFolder;
    }
}
